package com.neusoft.neuiotms.dcom.converter.insurance;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.insurance.InsuranceRegisterUnitDTO;
import com.neusoft.neuiotms.dcom.model.insurance.InsuranceRegisterUnit;

@Component
public class InsuranceRegisterUnitConverter extends AbstractConverter<InsuranceRegisterUnit, InsuranceRegisterUnitDTO> {

    @Override
    public InsuranceRegisterUnit toModel(final InsuranceRegisterUnitDTO dto) {

        final InsuranceRegisterUnit model = new InsuranceRegisterUnit();

        model.setUnitCode(dto.getUnitCode());
        model.setUnitName(dto.getUnitName());

        return model;
    }

    @Override
    public InsuranceRegisterUnitDTO toDTO(final InsuranceRegisterUnit model, final boolean forListView) {

        final InsuranceRegisterUnitDTO dto = new InsuranceRegisterUnitDTO();

        dto.setId(model.getId());
        dto.setUnitCode(model.getUnitCode());
        dto.setUnitName(model.getUnitName());

        return dto;
    }

}
